/*
 * Copyright 2011 J. Auer, J. Andert, F.-J. Jendrusch, U. Celebi
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.example.android.notepad;

import java.io.Serializable;

/**
 * This class wraps note data into an Java object which can be serialized and send to other devices for synchronization.
 */
public class Note implements Serializable {
	private static final long serialVersionUID = 5526396597944153983L;

	public static final String UPDATE = "update";

	private String title;
	private String note;

	/**
	 * Update flag in order to keep track of whether the note object really was updated or just transferred. This has to
	 * do with the way the content provider works. It's <code>update()</code> method is invoked on every data
	 * manipulation (e.g. when a note object has been received), but we only want an update, when we (the app) modify
	 * the note.
	 */
	private boolean update = true;

	/**
	 * Empty constructor.
	 */
	public Note() {
	}

	/**
	 * Constructor that sets title and text of note.
	 * 
	 * @param title Title of note
	 * @param note Text of note
	 */
	public Note(String title, String note) {
		this.title = title;
		this.note = note;
	}

	/**
	 * Return title of note.
	 * 
	 * @return Title of note
	 */
	public String getTitle() {
		return title;
	}

	/**
	 * Set title of note.
	 * 
	 * @param title Title of note
	 */
	public void setTitle(String title) {
		this.title = title;
	}

	/**
	 * Get text of note.
	 * 
	 * @return Text of note
	 */
	public String getNote() {
		return note;
	}

	/**
	 * Set text of note.
	 * 
	 * @param note Text of note
	 */
	public void setNote(String note) {
		this.note = note;
	}

	/**
	 * Check value of update flag.
	 * 
	 * @return Update flag value
	 */
	public boolean isUpdate() {
		return update;
	}

	/**
	 * Set value of update flag.
	 * 
	 * @param update Value of update flag
	 */
	public void setUpdate(boolean update) {
		this.update = update;
	}
}